var addrcashoutbill = require('../../model/cashout.js')
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    xtitle:{
      type:String,
      default:"提现记录"
    }
  },
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的初始数据
   */
  data: {
    activestatus:"-1",
    CustomBar:null,
    isshow:false,
    mode:"",
    id:-1,
    isload:false,
    modellist:[]
  },

  /**
   * 组件的方法列表
   */
  methods: {
     showmodel(mode,id) {
      var app = getApp()
      this.data.mode =mode    
      this.data.id= id;      
       this.setData({isshow:true,CustomBar:app.globalData.CustomBar}) 
       var that = this
       that.data.activestatus=0
       setTimeout(function (params) {
        //兼容样式不对问题 
        that.setData({activestatus:"0"})
       },300)

    
       return ;
         
       this.getpagelist( 1);
      },
    onNavChange:function (e) {
 
      this.setData({activestatus:e.detail.name})
      this.getpagelist( 1);
    },
    closefunc:function(e){
         this.setData({isshow:false})
    },
    onReachBottom: function (e) {
     
      this.getpagelist( -1);
    },
    getpagelist( rest, strwhere) {
    var   that = this
      if (rest == 1) {
        that.setData({
          modellist: []
        });
        if(!strwhere)
        {
          strwhere={}
        }
        strwhere["status"] =that.data.activestatus
        strwhere["type"] = this.data.mode
        strwhere["id"] = this.data.id
      }
      this.setData({ isload: true }) 
      addrcashoutbill.offset(that, rest,strwhere).then(function (result) {
      


        var updatemdoel = {};
        if ((result["code"] == "over" && result["obj"]) || result["code"] == "loadmore") {
          if (rest == 1) {
            updatemdoel["modellist"] = result["obj"]["modellist"];
          } else {
            if (result["obj"]["modellist"].length > 0) {
              updatemdoel["modellist"] = that.data.modellist.concat(result["obj"]["modellist"]);
            }
          }
        }
        updatemdoel["isload"] = false
        that.setData(updatemdoel);
      })
      return;
    },

  }
})
